package demo.app;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.client.RestTemplate;

@Controller
public class AppController {
	@RequestMapping("text")
    @ResponseBody
    public String text() {
        return "Hello World!";
    }
	
	@RequestMapping(value="text1")
	public String text1() {
		return "app";
	}
	
	@RequestMapping(name="text2")
	public String text2(Model model) {
		String xx="测试";
		model.addAttribute("name", xx);
		
		return "app";
	}
	
	public String text3() {
		RestTemplate restTemplate = new RestTemplate();
		
		String result = restTemplate.getForObject("http://www.baidu.com", String.class );
		
		return result;
	}
	
}
